<?php
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\bootstrap\ActiveForm;
use yii\helpers\Url;

?>
<?= Html::cssFile('./assets/css/uploadsoft.css')?>
<?= Html::jsFile('./assets/uploadsoft/jquery.min.js')?>
<?= Html::jsFile('./assets/uploadsoft/jquery.form.js')?>
<?= Html::jsFile('./assets/js/uploadteacher.js')?>

<div class="modal-dialog ">
	<div class="modal-content">
		<div class="modal-header">
			<button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
			<h4 class="modal-title">完善教师信息</h4>
		</div>
		<div class="modal-body">
			<table class="table table-striped table-condenseda table-bordered">
				<tbody>
					<tr>
						<th width="15%">用户名</th>
						<td width="85%"><?= Html::encode($teacher['username']) ?></td>
					</tr>
				</tbody>
			</table>
			<?php 
				$form = ActiveForm::begin([
					'options' => ['class' => 'form-horizontal',
					'enctype' => 'multipart/form-data',
					'id'=>'admins-form'],
					'action'=>Url::to(['user/teachersave']),
					'method'=>'post',
					'fieldConfig' => [
						'template' => '<div class="form-group"><center><label class="col-md-2 control-label" for="type-name-field">{label}</label></center><div class="col-md-8 controls">{input}{error}</div></div>'
					], 
				]);
			?>
				
				<?= $form->field($model, 'teacher_id', ['template'=>'{input}'])->hiddenInput() ?>
				
				<?= $form->field($model, 'teacher_name',['inputOptions'=>['placeholder'=>'请输入教师名称']])->textInput(['maxlength' => true]) ?>
				
				<?= $form->field($model, 'email',['inputOptions'=>['value'=>$teacher['email'],'placeholder'=>'请输入邮箱']])->textInput(['maxlength' => true]) ?>

				<?= $form->field($model, 'teacher_thumb', ['template'=>'{input}'])->hiddenInput() ?>
				<!-- <div class="form-group field-teacherinfo-email">
					<div class="form-group">
						<center>
							<label for="type-name-field" class="col-md-2 control-label">
								<label for="teacherinfo-email" class="control-label">添加教师头像</label>
							</label>
						</center>
						<div class="col-md-8 controls">
							<span>添加教师头像</span>
							<?= Html::fileInput('mypic','', ['id'=>'fileupload']) ?>
							<p class="help-block help-block-error"></p>
						</div>
					</div>
				</div> -->
				<div class="form-group" >
						<center>
							<label for="type-name-field" class="col-md-2 control-label">
								<label for="teacherinfo-email" class="control-label">教师头像</label>
							</label>
						</center>
						<div class="btn">
							<span>添加教师头像</span>
							<?= Html::fileInput('filedata','', ['id'=>'fileupload']) ?>
						</div>
						<div class="progress" style='margin-left:280px'>
							<span class="bar"></span><span class="percent">0%</span >
						</div>
						<div class="files" style='margin-left:100px'></div>
						<div id="showimg" style='margin-left:100px'></div>
				</div>
				<!-- <?= $form->field($model, 'teacher_thumb')->fileInput() ?> -->
				<!-- <div class="form-group" style="margin-left:20px" >
						<div class="col-md-2 control-label">
						<label for="name">添加教师头像</label>
						</div>
						<div class="btn" style="margin-left:-20px">
							<span>添加教师头像</span>
							<?= Html::fileInput('mypic','', ['id'=>'fileupload']) ?>
						</div>
						<div class="progress" style='margin-left:280px'>
							<span class="bar"></span><span class="percent">0%</span >
						</div>
						<div class="files" style='margin-left:136px'></div>
						<div id="showimg"></div>
				</div> -->

				<?php $model->from_id = $teacher['from_id'];?>
				<?= $form->field($model, 'from_id')->dropDownList($from, ['prompt' => '请选择教师来源']) ?>
		
				<?php $model->position_id = $teacher['position_id'];?>
				<?= $form->field($model, 'position_id')->dropDownList($position, ['prompt' => '请选择教师职位']) ?>

				<?= $form->field($model, 'teacher_at',['inputOptions'=>['placeholder'=>'请输入擅长领域']])->textInput(['maxlength' => true]) ?>

				<?= $form->field($model, 'teacher_desc',['inputOptions'=>['placeholder'=>'请输入教师描述']])->textArea(['rows' => '3']) ?>
				<div class="modal-footer">
					<?= Html::submitButton('保存', ['class' => 'btn btn-success','id'=>'user-create-btn']) ?>
					<button data-dismiss="modal" class="btn btn-primary" type="button">关闭</button>
				</div>
			<?php ActiveForm::end(); ?>
		</div>
		
	</div>
</div>